package labox.innovation.gameserver.skills.conditions;

import labox.innovation.gameserver.skills.Env;
import labox.innovation.gameserver.templates.item.L2Weapon;

/**
 * @author mkizub
 * 
 *         TODO To change the template for this generated type comment go to
 *         Window - Preferences - Java - Code Style - Code Templates
 */
public class ConditionTargetUsesWeaponKind extends Condition {

	private final int _weaponMask;

	public ConditionTargetUsesWeaponKind(int weaponMask) {
		_weaponMask = weaponMask;
	}

	@Override
	public boolean testImpl(Env env) {

		if (env.target == null)
			return false;

		L2Weapon item = env.target.getActiveWeaponItem();

		if (item == null)
			return false;

		return (item.getItemType().mask() & _weaponMask) != 0;
	}
}
